package name.panitz.mobile;
import javax.microedition.lcdui.*;
public class ImageObject extends MovableObject{
  Image img;
  ImageObject(int x,int y,double dX,double dY,Image img){
    super(x,y,dX,dY,0,0);
    this.img=img;
    width=img.getWidth();
    height=img.getHeight();
  }

  static Image load(String fileName){
    try{
      java.io.InputStream stream
        =ImageObject.class.getResourceAsStream(fileName);
      return Image.createImage(stream);
    }catch(Exception e){
      System.out.println(e);
      return null;
    }
  }

  ImageObject(int x,int y,double dX,double dY,String fileName){
    this(x,y,dX,dY,load(fileName));
  }

  public void paintMe(Graphics g){
    if(img!=null)g.drawImage(img,x,y,Graphics.TOP|Graphics.LEFT);
  }
}

